<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const arrays=[{ name:"唐玮",age:20},{name:"彩霞",age:250}];
        console.log(arrays[1].name);

        let tw=[12];
        tw[3]=252;
        console.log(tw.length);//4
        console.log(tw);//[12, 空 ×2, 252]
        console.log(tw[1]);//undefined

        //创建数组
        // let arr=new Array(6);
        // console.log(arr.length);//6,局限：自动创建了6个元素
        // console.table(arr)


        let arr= Array.of(6);
        console.log(arr.length);//1个，数值为6
        console.table(arr);
        console.table(arr[0])//6


        console.log(Array.isArray([21,22]));//true
        console.log(["唐玮","帅哥"].join(","));

        //字符串变为数组
        let str="唐玮真他妈的帅";
        console.log(str.split(""))//['唐', '玮', '真', '他', '妈', '的', '帅']


        //拷贝数组
        let fruit=[25,26,47];
        let arrayss=fruit.slice();
        console.log(arrayss);

        //删除多个数组多个元素
         let tables=["tw",21,25,32,14];
         console.log(tables.splice(1,3));//删除了[21,25,32]
       //删除单个
         tables.pop(1);
         console.log(tables.length);
       console.log(tables);//结果为["tw"]
        //indexof 数组元素的序号

        let name=["唐玮","何彩霞",'失败'];
        console.log(name.indexOf("唐玮"));//0
     //展开语法
     const str="ssqfeq";
    console.log([...str]);//['s', 's', 'q', 'f', 'e', 'q']
    </script>
</body>
</html>